from flask import Flask, jsonify
from flask_cors import CORS

app = Flask(__name__)
CORS(app)

@app.route('/api/user')
def get_user():
    return jsonify({"name": "测试用户", "role": "开发者"})

@app.route('/api/projects')
def get_projects():
    return jsonify([
        {"id": 1, "name": "项目A"},
        {"id": 2, "name": "项目B"}
    ])

@app.route('/api/data')
def get_data():
    return jsonify([
        {"id": 1, "title": "数据1"},
        {"id": 2, "title": "数据2"}
    ])

if __name__ == '__main__':
    app.run(debug=True)
